package com.snake.repositories;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.snake.mapper.ActivityCardMapper;
import com.snake.models.ActivityCard;
import com.snake.util.DateUtil;


@Service
public class ActivityCardServiceImpl implements ActivityCardService {
	@Autowired
	private ActivityCardMapper activityCardMapper;
	
	@Override
	public ActivityCard add(ActivityCard t) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ActivityCard delete(ActivityCard t) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ActivityCard update(ActivityCard t) {
		// TODO Auto-generated method stub
		String formatDate = DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss");
		t.setUpdateTime(formatDate);
		ActivityCard update = activityCardMapper.update(t);
		return update;
	}

	@Override
	public ActivityCard getById(int id) {
		// TODO Auto-generated method stub
		Map<String, Object> params=new HashMap<String, Object>();
		params.put("cardId", id);
		ActivityCard byId = activityCardMapper.getById(params);
		return byId;
	}

	@Override
	public List<ActivityCard> getByList(Map<String, Object> params) {
		// TODO Auto-generated method stub
		List<ActivityCard> byList = activityCardMapper.getByList(params);
		return byList;
	}
	
	
	
}
